# _*_ coding: utf-8 _*_
from odoo import models, fields, api


class ClassCodeMainTable(models.Model):
    _name = "class.code.main.table"

    name = fields.Char(compute="_compute_name")
    value_ids = fields.One2many("class.code.child.table", "table_id")
    module_code = fields.Char(string="Module Code")
    class_code = fields.Char(string="Class Code")
    description = fields.Text(string="Description")

    @api.depends("module_code", "class_code")
    @api.multi
    def _compute_name(self):
        for table in self:
            table.name = table.module_code + "-" + table.class_code
